< Prev(J) / Next(K) > / View :

Filename: /text/shared/explorer/database/02010100.xhp

(bookmark: bm_id3153323)
views; creating database views (Base)
queries; creating in design view (Base)
designing; queries (Base)
design view; queries/views (Base)
joining;tables (Base)
tables in databases; joining for queries (Base)
queries; joining tables (Base)
tables in databases; relations (Base)
relations; joining tables (Base)
queries; deleting table links (Base)
criteria of query design (Base)
queries; formulating filter conditions (Base)
filter conditions;in queries (Base)
parameters; queries (Base)
queries; parameter queries (Base)
SQL; queries (Base)
native SQL (Base)

ビュー; データベースビューの作成 (Base)
クエリー; デザインビューで作成 (Base)
デザイン; クエリー (Base)
デザインビュー; クエリー/ビュー (Base)
結合; テーブル (Base)
データベーステーブル; クエリー用に結合する (Base)
クエリー; テーブルの結合 (Base)
データベーステーブル; リレーション (Base)
リレーション; テーブルの結合 (Base)
クエリー; テーブルリンクの削除 (Base)
クエリーデザインの条件 (Base)
クエリー; フィルタ条件の作成 (Base)
フィルタ条件;クエリー内 (Base)
パラメータ; クエリー (Base)
クエリー; パラメータクエリー (Base)
SQL; クエリー (Base)
ネイティブ SQL (Base)

(par_id3153323.2)

Query Design
クエリーデザイン(hd_id3153394.1)

The Query Design View allows you to create and edit a database query.
クエリーのデザインビュー では、データベースクエリーを作成および編集できます。(par_id3156411.288)

(variable: wie)To access this command...(variable: wie)この機能の見つけ方

(embed text/shared/00/00000450.xhp#entwab : linkinfo)

In a database file window, click the Queries icon, then choose Edit - Edit
データベースファイルウィンドウで、クエリー アイコンをクリックしてから、編集 → 編集 を選択します。(par_id3149579.24)

(/embed text/shared/00/00000450.xhp#entwab)


Note Icon 注マーク Most databases use queries to filter or to sort database tables to display records on your computer. Views offer the same functionality as queries, but on the server side. If your database is on a server that supports views, you can use views to filter the records on the server to speed up the display time.
多くのデータベースでは、レコードをコンピュータに表示する際に、データベーステーブルのフィルタリングやソートのためにクエリーが使用されています。ビューも同様な機能を提供しますが、サーバーサイドで実行されます。ご使用のデータベースがビューをサポートするデータベースサーバー上にある場合、サーバー上でレコードをフィルタリングすることによって表示速度を向上できます。(par_id7024140.)

Note Icon 注マーク Selecting the Create View command from the Tables tab page of a database document, you see the View Design window that resembles the Query Design window described here.
データベースドキュメントの テーブル タブページから ビューを作成 コマンドを選択すると、ここで説明している クエリーデザイン ウィンドウに似た ビューデザイン ウィンドウが表示されます。(par_id3159176.276)

The Query Design window layout is stored with a created query, but cannot be stored with a created view.
「クエリーデザイン」ウィンドウのレイアウトは、作成したクエリーとともに保存されますが、作成したビューとともには保存できません。(par_id8307138.)

The Design View
デザインビュー(hd_id3149233.3)

To create a query, click the Queries icon in a database document, then click Create Query in Design View.
クエリーを作成するには、データベースドキュメント内で クエリー アイコンをクリックしてから、デザイン表示でクエリーを作成 をクリックします。(par_id3145673.4)

The lower pane of the Design View is where you define the query. To define a query, specify the database field names to include and the criteria for displaying the fields. To rearrange the columns in the lower pane of the Design View, drag a column header to a new location, or select the column and press (in case of MAC)Command(/in case of MAC)(in other case)Ctrl(/in other case)+arrow key.
「デザインビュー」の下部のパネルでは、クエリーの定義 を行います。クエリーを定義するには、データベースからクエリーに含める フィールド名 を指定し、フィールドを表示する 条件 を指定します。「デザインビュー」の下部のパネルで、列の配列を変えるには、列のヘッダーを移動先にドラッグするか、列を選択してから (in case of MAC)(Command)(/in case of MAC)(in other case)(Ctrl)(/in other case) + 矢印キーを押します。(par_id3150255.5)

In the top of the query Design View window, the icons of the Query Design Bar and the Design bar are displayed.
クエリーデザインの表示ウィンドウの最上段には、クエリーデザイン バーおよび デザイン バーのアイコンが表示されます。(par_id3152474.6)

If you want to test a query, double-click the query name in the database document. The query result is displayed in a table similar to the Data Source View. Note: the table displayed is only temporary.
クエリーをテストしたい場合は、データベースドキュメントのクエリー名をダブルクリックします。クエリーの結果は、データソースの表示に似たテーブルに表示されます。注: 表示されるテーブルは一時的なものです。(par_id3147559.287)

Keys in Query Design View
クエリーデザイン表示のキー(hd_id8226264.)

Key
キー(par_id2341074.)

Function
関数(par_id4384289.)

F4
F4(par_id5839106.)

Preview
プレビュー(par_id8554338.)

F5
F5(par_id1254921.)

Run Query
クエリーの実行(par_id7636646.)

F7
F7(par_id8579363.)

Add Table or Query
テーブルまたはクエリーの追加(par_id3227942.)


Browse
テーブルの選択(hd_id3154939.7)

When you open the query design for the first time, in order to create a new query, you can click Add Tables. You then see a dialog in which you must first select the table that will be the basis for the query.
最初にクエリーデザインを開いた場合は、新規クエリーを作成するため、テーブルの追加 をクリックします。これにより表示されるダイアログでは、クエリーで使用するテーブルを選択します。(par_id3148799.8)

(bookmark: bm_id3150767)

Double-click fields to add them to the query. Drag-and-drop to define relations.
フィールドをダブルクリックすると、フィールドがクエリーに追加されます。ドラッグ&ドロップすると、リレーションを定義できます。(par_id3144762.10)

Note Icon 注マーク While designing a query, you cannot modify the selected tables.
クエリーのデザイン中は、選択テーブルは変更できません。(par_id3157894.141)

Remove tables
テーブルの解除(hd_id3149562.11)

To remove the table from Design View, click the upper border of the table window and display the context menu. You can use the Delete command to remove the table from the Design View. Another option is to press the Delete key.
テーブルを作成画面から解除するには、テーブルウィンドウの上部枠をクリックして、コンテキストメニューを呼び出します。削除 コマンドを使って作成画面からテーブルを解除します。または、Deleteキーを押します。(par_id3150685.12)

(section: darstellungaendern)

Move table and modify table size
テーブルの移動とテーブルサイズの変更(hd_id3150012.142)

You can resize and arrange the tables according to your preferences. To move tables, drag the upper border to the desired position. Enlarge or reduce the size in which the table is displayed by positioning the mouse cursor on a border or on a corner and dragging the table until it is the desired size.
テーブルの並べ替えおよびサイズの変更を実施できます。テーブルを移動するには、マウスで上の枠をつかみ、目的の場所に引っ張ります。表示を拡大したり、縮小させるには、枠や角を引っ張ります。(par_id3146922.143)

(/section: darstellungaendern)

Table Relations
テーブル間の対応関係(hd_id3145365.13)

If there are data relations between a field name in one table and a field name in another table, you can use these relations for your query.
あるテーブルのフィールドと別のテーブルのフィールドとの間にデータの対応関係が存在する場合、その対応関係をクエリーに使用することができます。(par_id3154145.14)

If, for example, you have a spreadsheet for articles identified by an article number, and a spreadsheet for customers in which you record all articles that a customer orders using the corresponding article numbers, then there is a relationship between the two "article number" data fields. If you now want to create a query that returns all articles that a customer has ordered, you must retrieve data from two spreadsheets. To do this, you must tell Office what the relationship exists between the data in the two spreadsheets.
たとえば、商品管理用の表計算ドキュメントを用意して、個々の商品は商品番号で区別するものとし、これとは別にカスタマ管理用の表計算ドキュメントを用意して、個々の商品番号を使ってカスタマから注文されたすべての商品を記録するような場合、この両者の「商品番号」データフィールドには対応関係が生じます。そして、1 人の顧客が注文したすべての商品を一覧表示するクエリーを新規作成するには、この 2 つの表計算ドキュメントの双方からデータを抽出する必要があります。こうした処理を実施するには、2 つの表計算ドキュメントの間にどのような対応関係が存在するかを、Office に指定する必要があります。(par_id3152577.15)

To do this, click a field name in a table (for example, the field name "Item-Number" from the Customer table), hold down the mouse button and then drag the field name to the field name of the other table ("Item-Number" from the Item table). When you release the mouse button, a line connecting the two fields in the two windows appears. The corresponding condition that the content of the two field names must be identical is entered in the resulting SQL query.
テーブルの中のデータフィールド(例えば子テーブルの「登録番号」のデータフィールド)をクリックして、マウスのボタンを押したままの状態で別のテーブル(例えば親テーブルの「登録番号」)に引きます。ここでマウスのボタンを離すと、これら2つのフィールドをつなぐ線が表示されます。結果として生成される SQL クエリーでは、これらの項目がお互いに同じ値である必要があるという条件を指定します。(par_id3155302.16)

The creation of a query that is based on several related sheets is only possible if you use Office as the interface for a relational database.
複数の関連シートを使ったクエリーの作成は、リレーショナルデータベースのインタフェースとして Office を使用する場合のみ可能となります。(par_id3153876.137)

Note Icon 注マーク You cannot access tables from different databases in a query. Queries involving multiple tables can only be created within one database.
1 つのクエリーから異なるデータベースへはアクセスできません。複数のテーブルを使用するクエリーは、1 つのデータベース内部にのみ作成できます。(par_id3145646.246)

Specifying link type
リンク形式の指定(hd_id3153279.224)

If you double-click the line connecting two linked fields or call the menu command Insert - New Relation, you can specify the type of link in the Relations dialog.
リンクされた 2 つのフィールドを結ぶ接続線をダブルクリックするか、メニュー 挿入 → 新しいリレーション を選択すると、ダイアログ リレーション が開き、リンクの種類が指定できます。(par_id3154791.225)

(bookmark: bm_id3145253)

Alternatively, press Tab until the line is selected, then press Shift+F10 to display the context menu and there choose the command Edit. Some databases support only a subset of the possible join types.
または、行が選択されるまで Tab キーを押し、Shift + F10 キーを押して、コンテキストメニューを表示し、そこで 編集 コマンドを選択します。データベースによっては、選択可能な結合タイプのサブセットにしか対応していない場合があります。(par_id3150094.285)

Deleting relations
リンクを解除する(hd_id3155851.145)

To delete a relation between two tables, click the connection line and then press the Delete key.
2つのテーブルの間に存在するリンクを解除する場合、マウスでそのリンク線をクリックしてDeleteキーを押します。(par_id3156178.146)

Alternatively, delete the respective entries in Fields involved in the Relations dialog. Or press Tab until the connecting vector is displayed highlighted, then press Shift+F10 to open the context menu and select Delete command.
別の方法としては、ダイアログ リレーション使用フィールド から該当項目を削除することもできます。また、Tab キーを押して目的の接続線を強調表示させて (Shift) + (F10) キーを押すとコンテキストメニューが表示されるので、コマンド 削除 を選択します。(par_id3150715.284)

(bookmark: bm_id3152972)

Define query
クエリーの定義(hd_id3151208.17)

Select conditions to define the query. Each column of the design table accepts a data field for the query. The conditions in one row are linked with a Boolean AND.
クエリーを定義する条件を選択します。 作成されるテーブルの列はそれぞれクエリーのデータフィールドがあります。行に定義されている条件は論理的「AND」でリンクします。(par_id3158416.18)

Specify field name
データフィールドの指定(hd_id3154161.19)

First, select all field names from the tables that you want to add to the query. You can do this either with drag-and-drop or by double-clicking a field name in the table window. With the drag-and-drop method, use the mouse to drag a field name from the table window into the lower area of the query design. As you do this, you can decide which column you want to add the field to. Select a field name by double-clicking. It will then be added to the next free column.
まず、クエリーに追加するテーブルで、すべてのフィールド名を選択します。この操作は、テーブルウィンドウの各フィールド名をドラッグ&ドロップまたはダブルクリックすることで行えます。ドラッグ&ドロップで行う場合は、テーブルウィンドウにあるフィールド名をマウスでドラッグして、クエリーデザイン画面の下側にあるエリアにドロップします。この方法では、どの列にどのフィールドを追加するかを逐次指定できます。ダブルクリックでフィールド名を選択します。この方法では、一番左側の空欄の列に追加されてゆきます。(par_id3146791.20)

Deleting field names
データフィールドの解除(hd_id3150750.21)

To remove a field name from the query, click the column header of the field and choose the Delete command on the context menu for the column.
クエリーからデータフィールドを解除する場合、マウスで該当するフィールドに対応した列の頭をクリックして列のインデックスで 解除 コマンドを実行します。(par_id3154479.22)

Save query
クエリーの保存(hd_id3155764.277)

Use the Save icon on the Standard Bar to save the query. You see a dialog that asks you to enter a name for the query. If the database supports schemas, you can also enter a schema.
標準バーの 保存 アイコンをクリックしてクエリーを保存します。クエリーの名前を入力するダイアログが表示されます。データベースでスキーマがサポートされている場合には、スキーマを入力することもできます。(par_id3148481.278)

(bookmark: bm_id3156378)

Schema
スキーマ(hd_id3154362.279)

Enter the name of the schema that is assigned to the query or table view.
クエリービューとテーブルビューに割り当てるスキーマの名前を入力します。(par_id3154754.280)

(bookmark: bm_id3147340)

Query name or table view name
クエリービューとテーブルビューの名前(hd_id3156717.281)

Enter the name of the query or table view.
クエリービューとテーブルビューの名前を入力します。(par_id3154253.282)

Filtering data
データのフィルタリング(hd_id3163805.23)

To filter data for the query, set the desired preferences in the lower area of the Design View. The following lines are available:
クエリーでデータのフィルタリングを行うには、データビューの下面でフィルタリングの条件を設定します。設定できる条件行には、下記のものがあります。(par_id3154964.24)

(bookmark: bm_id3148536)

Field
フィールド(hd_id3146916.25)

Enter the name of the data field that you referred to in the Query. All settings made in the lower rows refer to this field. If you activate a cell with a mouse click you'll see an arrow button, which enables you to select a field. The "Table name.*" option selects all data fields and the criteria is valid for all table fields.
クエリーで参照するデータフィールド名を指定します。ここより下の行の設定は、すべてこのフィールドを対象とします。 マウスクリックでセルをアクティブにすると、矢印に変化したマウスポインタを使ってフィールドを選択できます。「テーブル名.*」形式のオプションは、すべてのデータフィールドを示すもので、これを選択すると、設定する条件はテーブル中の全フィールドを対象とするようになります。(par_id3156372.26)

(bookmark: bm_id3154702)

Alias
エイリアス(hd_id3145150.148)

Specifies an alias. This alias will be listed in a query instead of the field name. This makes it possible to use user-defined column labels. For example, if the data field has the name PtNo and, instead of that name, you would like to have PartNum appear in the query, enter PartNum as alias.
エイリアスを指定します。このエイリアスは、クエリーの実行結果で、フィールド名の代わりにリストされます。これによって、ユーザーが定義した列ラベルを使用することができるようになります。 たとえば、テーブル中の実際のデータフィールド名が PtNo であり、クエリーの実行結果ではこの名前の代わりに PartNum と表示させる場合には、エイリアスとして PartNum と入力します。(par_id3146315.149)

In an SQL statement, aliases are defined as following:
SQL ステートメントではエイリアスは次のように定義されます。(par_id3155959.193)

SELECT column AS alias FROM table.
SELECT column AS alias FROM table.(par_id3149922.194)

For example:
たとえば、(par_id3159335.195)

SELECT "PtNo" AS "PartNum" FROM "Parts"
SELECT "ItemNr" AS Item Number FROM "Item"(par_id3148478.196)

(bookmark: bm_id3154665)

Table
テーブル(hd_id3148485.27)

The corresponding database table of the selected data field is listed here. If you activate the a cell with a mouse click, an arrow will appear which enables you to select another table of the current query.
ここには、選択したデータフィールドに対応するデータベーステーブルが表示されます。 マウスクリックでセルをアクティブにすると、矢印に変化したマウスポインタを使って、現在のクエリーで使用する他のテーブルを選択できます。(par_id3163665.28)

(bookmark: bm_id3154202)

Sort
並べ替え(hd_id3154207.29)

If you click the cell, you can select among the sorting options: ascending, descending and not sorted. Text fields will be sorted alphabetically and numerical fields numerically. For most databases, administrators can set the sorting options.
セルをクリックすると、並べ替え順序のオプションを昇順、降順、および並べ替えなしから選択できます。テキストフィールドはアルファベット順にソートされ、数値フィールドは数値の順にソートされます。ほとんどのデータベースの場合、管理者が並べ替え順序のオプションを設定できます。(par_id3150979.30)

(bookmark: bm_id3149334)

Visible
表示(hd_id3150384.31)

If you mark the Visible property for a data field, that field will be visible in the query. If you only use a data field to formulate a condition, you do not necessarily need to show it.
データフィールドの 表示 プロパティーをオンにすると、クエリーでそのフィールドが表示されます。. 条件を記述するためだけにデータフィールドを使用する場合には、データフィールドを表示させる必要はありません。(par_id3146133.32)

(bookmark: bm_id3147130)

Criteria
条件(hd_id3154714.33)

Specifies the criteria by which the content of the data field should be filtered.
データフィールドの内容をフィルタする 条件 を指定します。(par_id3145134.34)

or
あるいは(hd_id3152477.35)

Here you can enter one additional criterion for filtering in each line. Multiple criteria in one column will be connected by an OR link.
各行毎にここで更なるフィルタリング条件を定義することができます。一つの列に対して複数の条件が存在する場合、これらは論理的「OR」で連結されます。(par_id3154585.36)

You can also use the context menu of the line headers in the lower area of the query design to insert another line for functions:
更に、クエリーのデザイン画面の下部にある行頭のコンテキストメニューで、関数を用いた行を一つ挿入できます。(par_id3148800.150)

(bookmark: bm_id3153275)

Functions
関数(hd_id3148419.151)

The functions you can run here depend on the database.
データベース製品によってさまざまな関数を実行できます。 (par_id3153233.152)

If you are working with the HSQL database, the list box in the Function row offers you the following options:
HSQL データベースであれば、機能行のリストボックスに次のようなオプションがあります。(par_id8760818.)

Option
オプション(par_id3150307.179)

SQL
SQL(par_id3166430.180)

Effect
結果(par_id3152993.181)

No function
機能なし(par_id3155377.162)

No function will be executed.
これにより機能の実行はありません。(par_id3155533.163)

Average
平均(par_id3166420.164)

AVG
AVG(par_id3145268.183)

Calculates the arithmetic mean of a field.
フィールドの算術平均を計算します。(par_id3154486.165)

Count
数量(par_id3149979.166)

COUNT
COUNT(par_id3154260.184)

Determines the number of records in the table. Empty fields can either be counted (a) or not (b).
テーブル内のレコード数をカウントします。空白フィールドは (a) または (b) の方式でカウントされます。(par_id3155810.167)

a) COUNT(*): Passing an asterisk as the argument counts all records in the table.
a)COUNT(*):アスタリスク(*)の引数を入力すると、テーブル内の全てのデータレコードが数えられます。(par_id3151333.197)

b) COUNT(column): Passing a field name as an argument counts only fields in which the field name in question contains a value. Null values (empty fields) will not be counted.
b)COUNT(column):データフィールドを引数として入力すると、指定されている値のデータフィールドがある全てのデータレコードが数えられます。Null 値(空のフィールド)はこの場合数えられません。(par_id3152889.198)

Maximum
最高(par_id3153067.168)

MAX
MAX(par_id3148840.185)

Determines the highest value of a field.
フィールドでの最高値を算出します。(par_id3159221.169)

Minimum
最低(par_id3146866.170)

MIN
MIN(par_id3148604.186)

Determines the lowest value of a field.
フィールドでの最低値を算出します。(par_id3157982.171)

Sum
合計(par_id3154828.172)

SUM
SUM(par_id3147070.187)

Calculates the sum of values of associated fields.
付属する全てのフィールドの値の合計を算出します。(par_id3154536.173)

Group
グループ化(par_id3148820.174)

GROUP BY
グループ単位(par_id3145375.188)

Groups query data according to the field name selected. Functions are executed according to the specified groups. In SQL, this option corresponds to the GROUP BY clause. If a criterion is added, this entry appears in the SQL HAVING.
選択したフィールド名により、クエリーのデータをグループ化します。この関数の実行結果は、指定したグループに応じて変化します。このオプションは、SQL の GROUP BY 句に該当します。追加した条件は、SQL の HAVING 句に追加されます。(par_id3149438.175)


You can also enter function calls directly into the SQL statement. The syntax is:
関数呼び出しは、SQL ステートメント内に直接指定することもできます。構文は下記の形式で指定します。(par_id3156038.189)

SELECT FUNCTION(column) FROM table.
SELECT FUNCTION(column) FROM table.(par_id3156340.190)

For example, the function call in SQL for calculating a sum is:
たとえば次のように SQL 文の中で合計算出の関数を使用できます。(par_id3155075.191)

SELECT SUM("Price") FROM "Article".
SELECT SUM("Price") FROM "Item".(par_id3154591.192)

Except for the Group function, the above functions are so-called Aggregate functions. These are functions that calculate data to create summaries from the results. Additional functions that are not listed in the list box might be also possible. These depend on the specific database system in use and on the current state of the Base driver.
グループ機能を除いて、上記機能はいわゆる集計機能です。これらの機能は、データを計算し、その結果から集計を生成する機能です。リストボックスにない追加機能も可能です。これは使われているデータベースシステムや Base のドライバの最新ステータスによります。(par_id3159205.176)

To use other functions not listed in the list box, you must enter them under Field.
リストボックスにないほかの機能を使うためには、フィールドにそれを入力しなければなりません。(par_id3148651.177)

You can also assign aliases to function calls. If the query is not to be displayed in the column header, enter the desired name under Alias.
関数呼び出しでエイリアスを使うこともできます。クエリーが列の先頭に表示されない場合は、エイリアス の行に任意の名前を入力できます。(par_id3155098.178)

The corresponding function in an SQL statement is:
SQL ステートメントでは対象となる関数を次のように呼び出します。(par_id3155539.199)

SELECT FUNCTION() AS alias FROM table
SELECT FUNCTION() AS エイリアス FROM table(par_id3149425.200)

Example:
例:(par_id3144431.201)

SELECT COUNT(*) AS count FROM "Item"
SELECT COUNT(*) AS 数量 FROM "Item"(par_id3154614.202)

Note Icon 注マーク If you run this function, you cannot insert any additional columns for the query other than receiving these columns as a "Group" function.
関数を使用する場合、クエリーの中に「グループ化」されている列以外の列を入れることはできません。(par_id3154610.203)

Examples
例:(par_id3154644.204)

In the following example, a query is run through two tables: an "Item" table with the "Item_No" field and a "Suppliers" table with the "Supplier_Name" field. In addition, both tables have a common field name "Supplier_No."
次の例では、2つのテーブルを対象とするクエリーを実行します。Item_No フィールドを持つ Item テーブルと Supplier_Name フィールドを持つSuppliers テーブルがあります。また、両方のテーブルには Supplier_No というフィールドがあります。(par_id3151120.205)

The following steps are required to create a query containing all suppliers who deliver more than three items.
すべての suppliers を対象として 3 つ以上の Item が含まれるクエリーを作成するには次のステップが必要です。(par_id3155144.206)

  1. Insert the "Item" and "Suppliers" tables into the query design.
    テーブル Item と suppliers をクエリーのデザインに挿入します。(par_id3153240.207)

  2. Link the "Supplier_No" fields of the two tables if there is not already a relation of this type.
    テーブル間にリレーションがまだなければ、両方のテーブルの Supplier_No フィールドをつなぎます。(par_id3148807.208)

  3. Double-click the "Item_No" field from the "Item" table. Display the Function line using the context menu and select the Count function.
    テーブル Item からフィールド Item_No をダブルクリックします。コンテキストメニューで 関数 の行を表示させて関数 Count を選択します。(par_id3161652.209)

  4. Enter >3 as a criterion and disable the Visible field.
    条件として「>3」を入力し、可視フィールドをオフにします。(par_id3151009.210)

  5. Double-click the "Supplier_Name" field in the "Suppliers" table and choose the Group function.
    テーブル Suppliers からフィールド Supplier_Name をダブルクリックして、関数グループを選択します。(par_id3145601.211)

  6. Run the query.
    クエリーを実行します。(par_id3147512.212)

If the "price" (for the individual price of an article) and "Supplier_No" (for the supplier of the article) fields exist in the "Item" table, you can obtain the average price of the item that a supplier provides with the following query:
テーブル Item のフィールド price(各商品の単価)とフィールド Supplier_No (Item の supplier)があるときは、supplier が提供する Item の平均価格は次のようにして求められます。(par_id3148638.213)

  1. Insert the "Item" table into the query design.
    テーブル Item をクエリーのデザインに挿入します。(par_id3153045.214)

  2. Double-click the "Price" and "Supplier_No" fields.
    フィールド Price と フィールド Supplier_No をダブルクリックします。(par_id3149802.215)

  3. Enable the Function line and select the Average function from the "Price" field.
    関数 の行をオンにしてフィールド Price で関数 Average を選択します。(par_id3153554.216)

  4. You can also enter "Average" in the line for the alias name (without quotation marks).
    エイリアスの行に Average と入力することもできます。(par_id3155597.217)

  5. Choose Group for the "Supplier_No" field.
    フィールド Supplier_No でグループ化を選択します。(par_id3151191.218)

  6. Run the query.
    クエリーを実行します。(par_id3155547.219)

The following context menu commands and symbols are available:
以下に示すコンテキストメニューコマンドとアイコンがあります。(par_id3147549.247)

Functions
関数(hd_id3154172.248)

Shows or hides a row for selection of functions.
関数選択行の表示、非表示を切り替えます。(par_id3150414.249)

Table Name
テーブル名(hd_id3149872.153)

Shows or hides the row for the table name.
テーブル名の行の表示、非表示が切り替わります。(par_id3147246.154)

Alias Name
エイリアス名(hd_id3145117.155)

Shows or hides the row for the alias name.
エイリアス行の表示 / 非表示を切り替えます。(par_id3155754.156)

Distinct Values
固有値(hd_id3153298.157)

Applies only distinct values to the query. This applies to records containing data that appears several times in the selected fields. If the Distinct Values command is active, you will see only one record in the query (DISTINCT). Otherwise, you will see all records corresponding to the query criteria (ALL).
クエリーに固有値のみが適用されます。 選択したフィールドに複数回登場するデータが含まれているレコードに適用されます。固有値 コマンドが有効な場合、クエリーでは 1 レコードだけが表示されます (DISTINCT)。それ以外の場合、クエリー条件に該当するすべてのレコード行がそのまま表示されます (ALL)。(par_id3147500.158)

For example, if the name "Smith" occurs several times in your address database, you can choose the Distinct Values command to specify in the query that the name "Smith" will occur only once.
たとえば、「Smith」という名前が複数登録されているアドレス帳データベースを扱う場合に、コマンド 「固有値」 を使うことで、「Smith」という名前を 1 度だけ抽出するようにできます。(par_id3150436.159)

For a query involving several fields, the combination of values from all fields must be unique so that the result can be formed from a specific record. For example, you have "Smith in Chicago" once in your address book and "Smith in London" twice. With the Distinct Values command, the query will use the two fields "last name" and "city" and return the query result "Smith in Chicago" once and "Smith in London" once.
複数のフィールドを抽出するクエリーでは、それらのフィールドデータの組み合わせが一意になり、その結果が固有のレコードになる必要があります。たとえばアドレス帳に、「Smith in Chicago」(シカゴ在住の Smith 氏) に該当する人物は 1 人だけ登録されているのに、「Smith in London」(ロンドン在住の Smith 氏) は 2 人分登録されているものとします。この場合のクエリーでは「last name」と「city」の 2 つのフィールドを使用しますが、その際にコマンド 「固有値」 をオンにすることで、「Smith in Chicago」と「Smith in London」に該当する結果をそれぞれ 1 回ずつ出力するようにできます。(par_id3152352.160)

In SQL, this command corresponds to the DISTINCT predicate.
このコマンドに該当する SQL のキーワードは DISTINCT です。(par_id3149825.161)

Formulating filter conditions
フィルタ条件の作成(hd_id3148926.37)

(section: abfragekriterien)

When formulating filter conditions, various operators and commands are available to you. Apart from the relational operators, there are SQL-specific commands that query the content of database fields. If you use these commands in the Office syntax, Office automatically converts these into the corresponding SQL syntax. You can also enter the SQL command directly. The following tables give an overview of the operators and commands:
フィルタリング条件の指定には、様々な演算子とコマンドを利用できます。SQL コマンドには、関係演算子以外にも、データベースフィールドの内容に対するクエリー処理を行うためのコマンドが各種存在します。Office の構文でこれらのコマンドを使用した場合は、Office が自動的に対応する SQL 構文に変換します。また SQL コマンドを直接入力することもできます。下記の一覧は、演算子とコマンドを簡単にまとめたものです。(par_id3153162.38)

Operator
演算子(par_id3149044.39)

Meaning
意味(par_id3152471.40)

Condition is satisfied if...
次のことが起きると条件が満たされる...(par_id3147407.41)

=
=(par_id3156161.42)

equal to
等しい(par_id3153026.43)

... the content of the field is identical to the indicated expression.
... 指定値とフィールド値は一致する。(par_id3148895.44)

The operator = will not be displayed in the query fields. If you enter a value without any operator, the operator = will be automatically adopted.
<emph>=</emph> 演算子はクエリーフィールドでは表示されません; 演算子なしの値を入力すると <emph>=</emph> 演算子が使用されます。(par_id3153120.250)

<>
<>(par_id3150470.45)

not equal to
等しくない(par_id3145223.46)

... the content of the field does not correspond to the specified expression.
... 指定値とフィールド値は一致しない。(par_id3145635.47)

>
>(par_id3153015.48)

greater than
大きい(par_id3146815.49)

... the content of the field is greater than the specified expression.
... 指定値よりもフィールド値は大きい。(par_id3149150.50)

<
<(par_id3147270.51)

less than
小さい(par_id3147379.52)

... the content of the field is less than the specified expression.
... 指定値よりもフィールド値は小さい。(par_id3150375.53)

>=
>=(par_id3149787.54)

greater than or equal to
大きいか同等(par_id3150636.55)

... the content of the field is greater than or equal to the specified expression.
... 指定値とフィールド値は同等か、その方が大きい。(par_id3154584.56)

<=
<=(par_id3157964.57)

less than or equal to
小さいか同等(par_id3154052.58)

... the content of the field is less than or equal to the specified expression.
... 指定値とフィールド値は同等か、その方が小さい。(par_id3157902.59)


Office command
Office コマンド(par_id3154630.60)

SQL command
SQL コマンド(par_id3150484.61)

Meaning
意味(par_id3154158.62)

Condition is satisfied if...
次のことが起きると条件が満たされる...(par_id3149433.63)

IS EMPTY
IS EMPTY(par_id3154275.64)

IS NULL
IS NULL(par_id3149893.65)

is null
null(par_id3143236.66)

... The field name is empty. For Yes/No fields with three states, this command automatically queries the undetermined state (neither Yes nor No).
... データフィールドは空です。3種類の状況が可能な「はい」「いいえ」のフィールドで、このコマンドは不特定な状況(「はい」でも「いいえ」でもない)を確認します。(par_id3154744.67)

IS NOT EMPTY
IS NOT EMPTY(par_id3146940.68)

IS NOT NULL
IS NOT NULL(par_id3147471.69)

is not empty
空でない(par_id3151229.70)

... the field name is not empty.
... データフィールドは空ではない。(par_id3145304.71)

LIKE
LIKE(par_id3153578.72)

(placeholder * for any number of characters
(任意の数の文字のワイルドカード文字は*(par_id3153891.73)

placeholder ? for exactly one character)
1文字のワイルドカード文字は ? )(par_id3148887.74)

LIKE
LIKE(par_id3148623.75)

(bookmark: bm_id3157985)
placeholders; in SQL queries

SQL クエリー内のプレースホルダ

(% placeholder for any number of characters
(任意の数の文字に対応する % プレースホルダ)(par_id3157985.76)

Placeholder _ for exactly one character)
一文字のワイルドカード文字 _ )(par_id3147422.77)

is an element of
検索パターンと一致する(par_id3154845.78)

... the data field contains the indicated expression. The (*) placeholder indicates whether the expression x occurs at the beginning of (x*), at the end of (*x) or inside the field content (*x*). You can enter as a placeholder in SQL queries either the SQL % character or the familiar (*) file system placeholder in the Office interface.
... 指定値がフィールド値に含まれている。ワイルドカード文字「*」はxの値が開始時点「x*」なのか、終了時点「*x」なのか、それともフィールド値の範囲内「*x*」なのかを示します。ワイルドカード文字として、SQL クエリーで SQL 文字である %を使用できます。この場合、Office の上層部のファイルシステムにワイルドカード文字「*」が存在するものとします。(par_id3156130.79)

The * or % placeholder stands for any number of characters. The question mark (?) in the Office interface or the underscore (_) in SQL queries is used to represent exactly one character.
ここのワイルドカード文字「*」および「%」は複数の任意の文字です。Office の疑問符「?」や SQL クエリーの下線「_」は、任意の一文字を表します。(par_id3150271.80)

NOT LIKE
NOT LIKE(par_id3152954.81)

NOT LIKE
NOT LIKE(par_id3161669.82)

Is not an element of
検索パターンと一致しない(par_id3159141.83)

... the field name does not contain the specified expression.
... 指定値がフィールド値に含まれていない。(par_id3161664.84)

BETWEEN x AND y
BETWEEN x AND y(par_id3149185.85)

BETWEEN x AND y
BETWEEN x AND y(par_id3151259.86)

falls within the interval [x,y]
区間 [x,y] に存在する(par_id3159184.87)

... the field name contains a value that lies between the two values x and y.
... データフィールドの値はx値とy値の間の値である。(par_id3154395.88)

NOT BETWEEN x AND y
NOT BETWEEN x AND y(par_id3154561.89)

NOT BETWEEN x AND y
NOT BETWEEN x AND y(par_id3148753.90)

Does not fall within the interval [x,y]
区間[x,y]には存在しない(par_id3155498.91)

... the field name contains a value that does not lie between the two values x and y.
... データフィールドの値はx値とy値の間の値ではない。(par_id3148992.92)

IN (a; b; c...)
IN (a; b; c...)(par_id3149995.93)

Note that the semicolons are used as separators in all value lists!
全ての値リストで区切りに使っているセミコロンに注意してください。(par_id3159167.251)

IN (a, b, c...)
IN (a, b, c...)(par_id3159085.94)

contains a, b, c...
a, b, c..を含む(par_id3154809.95)

... the field name contains one of the specified expressions a, b, c,... Any number of expressions can be specified, and the result of the query is determined by an Or link. The expressions a, b, c... can be either numbers or characters
... 指定値a, b, c,...のどれかがフィールド値に含まれている。多くの任意の値を対象にすることができ、クエリーの結果は論理「OR」で求められます。a, b, c... といった値は数値でも文字でもかまいません(par_id3148399.96)

NOT IN (a; b; c...)
NOT IN (a; b; c...)(par_id3154112.97)

NOT IN (a, b, c...)
NOT IN (a, b, c...)(par_id3153544.98)

does not contain a, b, c...
a, b, c..を含まない(par_id3150679.99)

... the field name does not contain one of the specified expressions a, b, c,...
... 指定値a, b, c,...のどれかがフィールド値に含まれていない。(par_id3158439.100)

= TRUE
= TRUE(par_id3145145.101)

= TRUE
= TRUE(par_id3146804.102)

has the value True
「True」値(par_id3149248.103)

... the field name has the value True.
...「True」値がフィールド値に含まれている。(par_id3148524.104)

= FALSE
= FALSE(par_id3159212.105)

= FALSE
= FALSE(par_id3144751.106)

has the value false
「False」値(par_id3149955.107)

... the field name has the value false.
...「False」値がフィールド値に含まれている。(par_id3146850.108)


Examples
例)(hd_id3155954.117)

='Ms.'
='Ms.'(par_id3153792.118)

returns field names with the field content "Ms."
"Ms."という値が含まれているデータフィールドを返します。(par_id3150948.119)

LIKE 'g?ve'
LIKE 'g?ve'(par_id3150333.120)

returns field names with field content such as "give" and "gave".
フィールド中に「give」や「gave」などのデータを含むフィールド名を返します。(par_id3147332.121)

LIKE 'S*'
LIKE ''S*'(par_id3146062.122)

returns data fields with field contents such as "Sun".
「Sun」という値が含まれているデータフィールドを返します。(par_id3155350.123)

BETWEEN 10 AND 20
BETWEEN 10 AND 20(par_id3152883.124)

returns field names with field content between the values 10 and 20. (The fields can be either text fields or number fields).
値が10と20の間のデータフィールドを引き渡します。(この場合、対象となるのはテキストフィールドと数値フィールドの両方です。)(par_id3159406.125)

IN (1; 3; 5; 7)
IN (1; 3; 5; 7)(par_id3148765.126)

returns field names with the values 1, 3, 5, 7. If the field name contains an item number, for example, you can create a query that returns the item having the specified number.
1、3、5、7の値が含まれるデータフィールドを返します。たとえば、item number のような登録番号を含むデータフィールドを対象とする場合、特定の登録番号の結果を返します。(par_id3149712.127)

NOT IN ('Smith')
NOT IN ('Muller')(par_id3152948.128)

returns field names that do not contain "Smith".
「Muller」という値が含まれていないデータフィールドを返します。(par_id3147279.129)


(/section: abfragekriterien)

Date fields are represented as #Date# to clearly identify them as dates. The date condition will be reproduced in the resulting SQL statement in the following ODBC - compliant way:
日付フィールド は #Date# と指定することで、日付であることを明示します。日付条件は、ODBC に準拠した下記の書式で、SQL ステートメント内に再現されます。(par_id3157998.252)

Date
日付(par_id3153734.253)

{D'YYYY-MM-DD'}
{D'YYYY-MM-DD'}(par_id3159131.254)

Date time
日付と時刻(par_id3153937.255)

{D'YYYY-MM-DD HH:MM:SS'}
{D'YYYY-MM-DD HH:MM:SS'}(par_id3146090.256)

Time
時刻(par_id3155947.257)

{D'HH:MM:SS'}
{D'HH:MM:SS'}(par_id3150964.258)


Office also supports the following Escape sequences known from ODBC and JDBC:
さらに、Office は次の ODBC および JDBC で使用される エスケープシーケンス をサポートしています。(par_id3151220.260)

Date
日付(par_id3157975.261)

{d 'YYYY-MM-DD'}
{d 'YYYY-MM-DD'}(par_id3149753.262)

Time
時刻(par_id3156318.263)

{t 'HH:MI:SS[.SS]'} - [ ] optional
{t 'HH:MI:SS[.SS]'} - [ ] は省略可能(par_id3151280.264)

DateTime
日付と時刻(par_id3153264.265)

{ts 'YYYY-MM-DD HH:MI:SS[.SS]'} - [ ] optional
{ts 'YYYY-MM-DD HH:MI:SS[.SS]'} - [ ] は省略可能(par_id3153981.266)


Example: select {d '1999-12-31'} from world.years
例:select {d '1999-12-31'} from world.years(par_id3149539.267)

Like Escape Sequence: {escape 'escape-character'}
Like Escape Sequence:{escape 'escape-character'}(par_id3146073.268)

Example: select * from Item where ItemName like 'The *%' {escape '*'}
例)select * from Item where Item Name like 'The *%' {escape '*'}(par_id3150661.269)

The example will give you all of the entries where the item name begins with 'The *'. This means that you can also search for characters that would otherwise be interpreted as placeholders, such as *, ?, _, % or the period.
この例では、「The *」で始まる項目名全ての内容が得られます。尚、ここでは一般的にワイルドカード文字として扱われている記号である「*」、「?」、「 _」、または「%」およびピリオド等も検索できます。(par_id3148541.270)

Outer Join Escape Sequence: {oj outer-join}
Outer Join Escape Sequence:{oj outer-join}(par_id3150572.271)

Example: select Article.* from {oj item LEFT OUTER JOIN orders ON item.no=orders.ANR}
例)select Item.* from {oj Item LEFT OUTER JOIN orders ON Item.No=orders.ANR}(par_id3156052.272)

Querying text fields
テキストフィールドのクエリー(hd_id3153674.109)

To query the content of a text field, you must put the expression between single quotes. The distinction between uppercase and lowercase letters depends on the database in use. LIKE, by definition, is case-sensitive (though some databases don't see it that strict).
テキストフィールドは、値を引用符号でくくる必要があります。大文字と小文字の区別はしません。(par_id3149134.110)

Querying date fields
日付フィールドのクエリー(hd_id3149302.111)

Even if you want to filter by a date, you must place the expression between single quotation marks. The following formats are valid: YYYY-MM-DD HH:MM:SS and YYYY/MM/DD HH:MM:SS as well as YYYY.MM.DD HH:MM:SS
日付フィールドは、値を引用符号でくくる必要があります。以下の形式が可能です。YYYY-MM-DD HH:MM:SS および YYYY/MM/DD HH:MM:SS または YYYY.MM.DD HH:MM:SS(par_id3150510.112)

Querying Yes/No fields
はい/いいえフィールドからのクエリー実行(hd_id3150427.228)

To query Yes/No fields, use the following syntax for dBASE tables:
YES/NO フィールドをクエリーするには、dBASE テーブル用の次の構文を使用します。(par_id3149523.229)

Status
ステータス(par_id3153180.230)

Query criterion
クエリー条件(par_id3147481.231)

Example
(par_id3155187.232)

Yes
はい(par_id3156092.233)

for dBASE tables: not equal to any given value
dBASE テーブルの場合:所定の値以外(par_id3152414.234)

=1 returns all records where the Yes/No field has the status "Yes" or "On" (selected in black),
=1 では「はい」または「ON」のステータスを示す(黒い印)のはい/いいえフィールドの全てのデータレコードが返されます。(par_id3151265.236)

No
いいえ(par_id3152450.238)

.
0(par_id3150997.239)

=0 returns all records for which the Yes/No field has the status "No" or "Off" (no selection).
=0 では「いいえ」または「OFF」のステータスを示す(黒い印)のはい/いいえフィールドの全てのデータレコードが返されます。(par_id3155331.240)

Null
Null(par_id3154179.241)

IS NULL
IS NULL(par_id3147035.242)

IS NULL returns all records for which the Yes/No field has neither of the states Yes or No (selected in gray).
「IS NULL」では「はい」でも「いいえ」でもないステータスを示す(灰色の印)はい/いいえフィールドのすべてのレコードが返されます。(par_id3159385.243)


Note Icon 注マーク The syntax depends on the database system used. You should also note that Yes/No fields can be defined differently (only 2 states instead of 3).
これらの構文は、使用するデータベースにより異なります。また Yes/No フィールドも、これとは異なる方式を使用している場合があります (3 つの状態ではなく、2 つの状態のみなど)。(par_id3157888.244)

Parameter queries
パラメータクエリー(hd_id3145772.113)

You must place the variable between square brackets (=[x]) to create a query with variable parameters. Alternatively, you can use an equal sign followed by a colon (=:x). When the query is executed, the program will display a dialog asking you for the expression to which the variable x should be assigned.
パラメータに変数を用いるクエリーを作成するには、変数を大かっこで囲んで指定します (=[x]) 。また、イコール記号とコロンを使うこともできます (=:x)。このタイプのクエリーを実行すると、変数 x に割り当てる値を指定するためのダイアログが表示されます。(par_id3157312.114)

If you query several parameters at the same time, you will see a list field in the dialog containing all of the parameters and an input line alongside each one. Enter the values, preferably from top to bottom, and press the Enter key after each line.
同時に複数の変数を使用するクエリーの場合、ダイアログには値の入力行とともに、すべての変数がリスト表示されます。1 つの変数に指定する値を入力して Enter キー押すと、次の変数の入力が行えます。(par_id3150818.273)

Note Icon 注マーク Parameter queries with placeholders (*, _) or special characters (for example, ?) are not possible.
パラメータクエリーには、プレースホルダ (* や _) および特殊記号 (? など) は使用できません。(par_id3157855.115)

If you formulate a parameter query and you save it with the variables, you can later create a query in which only the variables have to be replaced by the expressions that you want. Office asks for these variables in a dialog as soon as you open the query.
変数を使ったパラメータクエリーを保存しておくと、変数部分だけを置き換えたクエリーを繰り返し実行できるようになります。こうしたクエリーを実行すると、変数値の指定用ダイアログが Office により表示されます。(par_id3157537.116)

Parameter Input
パラメータ入力(hd_id3151035.139)

The Parameter Input dialog asks you which variables you defined in the query. Enter a value for each query variable and confirm by clicking OK.
パラメータ入力 のダイアログでは、クエリーに指定した変数の確認を行います。個々のクエリー変数に割り当てる値を入力し、OK をクリックして確定します。(par_id3153596.140)

Parameter queries are also used for subforms, since they work exclusively with queries for which the values to be invoked are read internally from a variable.
サブフォームの場合も、使用するクエリーは内部的に値を変数に読み込むものであるため、パラメータクエリーを利用できます。(par_id3150585.138)

A parameter query can have the following form in an SQL statement:
SQL ステートメントではパラメータクエリーは次のような構文になります。(par_id3153645.274)

select * from 'addresses' where 'name' = :placeholder
select * from 'adressen' where 'name' = :placeholder(par_id3156731.275)

SQL Mode
SQL モジュール(hd_id3145181.135)

SQL stands for "Structured Query Language" and describes instructions for updating and administering relational databases.
SQL とは「Structured Query Language」の略字であり、リレーショナルデータベースへのクエリーを実行と管理のためにの命令を表現するものです。(par_id3147013.220)

In Office you do not need any knowledge of SQL for most queries, since you do not have to enter the SQL code. If you create a query in the query design, Office automatically converts your instructions into the corresponding SQL syntax. If, with the help of the Switch Design View On/Off button, you change to the SQL view, you can see the SQL commands for a query that has been created previously.
Office で行うクエリー処理の大半は、直接 SQL コードを入力する必要がないため、特に SQL に関する知識が無くても利用できます。クエリーデザインで作成したクエリーは、Office により自動的に対応する SQL 構文に変換されます。作成したクエリーがどのような SQL コマンドに変換されるかは、デザインビューの切り替えオン/オフ ボタンをクリックして、SQL ビューを表示することで確認できます。(par_id3152570.136)

You can formulate your query directly in the SQL code. Note, however, that the special syntax is dependent upon the database system that you use.
SQL コードで直接クエリーを作成することもできます。その場合、特別な構文は対象のデータベースシステムに依存するということを忘れないようにします。(par_id3152412.226)

If you enter the SQL code manually, you can create SQL-specific queries that are not supported by the graphical interface in Query design. These queries must be executed in native SQL mode.
手で SQL コードを作成する場合、クエリーのデザイン の画像の上層部でサポートされていない SQL 特有のクエリーを作成できます。クエリーはネイティブ SQL モジュールで実行する必要があります。(par_id3146842.227)

By clicking the Run SQL command directly icon in the SQL view, you can formulate a query that is not processed by Office.
SQL ビューでアイコン SQL コマンドを直接実行 をクリックすると、Office が自動作成する以外のクエリーも入力できます。(par_id3149632.223)


< Prev / Next >